Skip to content

Commit

Permalink
initialise package
Browse files Browse the repository at this point in the history
  • Loading branch information
zavr-1 committed Nov 1, 2018
1 parent 2bf6c40 commit fe94112
Show file tree
Hide file tree
Showing 28 changed files with 701 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .alamoderc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"env": {
"test-build": {
"import": {
"replacement": {
"from": "^((../)+)src",
"to": "$1build"
}
}
}
}
}
6 changes: 6 additions & 0 deletions .documentary/section-breaks/-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .documentary/section-breaks/0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .documentary/section-breaks/1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .documentary/section-breaks/2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "artdeco"
}
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ bower_components
# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
# Typescript v1 declaration files
typings/

# Optional npm cache directory
Expand All @@ -56,6 +56,3 @@ typings/

# dotenv environment variables file
.env

# next.js build output
.next
45 changes: 45 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Zoroaster",
"program": "${workspaceFolder}/node_modules/.bin/zoroaster",
"env": {
"NODE_DEBUG": "depack",
},
"console": "integratedTerminal",
"args": [
"test/spec",
"test/mask",
"-a",
"-w",
"-t",
"9999999"
],
"skipFiles": [
"<node_internals>/**/*.js"
]
},
{
"type": "node",
"request": "launch",
"name": "Launch Example",
"program": "${workspaceFolder}/example/index.js",
"env": {
"NODE_DEBUG": "depack",
},
"console": "integratedTerminal",
"args": [
"example/example.js"
],
"skipFiles": [
"<node_internals>/**/*.js"
]
}
]
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 1 November 2018

### 1.0.0

- Create `depack` with [`mnp`][https://mnpjs.org]
- [repository]: `src`, `test`
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Art Deco
Copyright (c) 2018 Art Deco Code Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,65 @@
# depack
Unpackager Of Dependencies To Create "Zero-Dependency Build" With Closure.

[![npm version](https://badge.fury.io/js/depack.svg)](https://npmjs.org/package/depack)

`depack` is Unpackager Of Dependencies To Create "Zero-Dependency Build" With Closure.

```sh
yarn add -E depack
```

## Table Of Contents

- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`depack(arg1: string, arg2?: boolean)`](#mynewpackagearg1-stringarg2-boolean-void)
* [`Config`](#type-config)
- [Copyright](#copyright)

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/0.svg?sanitize=true"></a></p>

## API

The package is available by importing its default function:

```js
import depack from 'depack'
```

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/1.svg?sanitize=true"></a></p>

## `depack(`<br/>&nbsp;&nbsp;`arg1: string,`<br/>&nbsp;&nbsp;`arg2?: boolean,`<br/>`): void`

Call this function to get the result you want.

__<a name="type-config">`Config`</a>__: Options for the program.

| Name | Type | Description | Default |
| --------- | --------- | ----------------- | ------- |
| shouldRun | _boolean_ | A boolean option. | `true` |
| __text*__ | _string_ | A text to return. | - |

```js
/* yarn example/ */
import depack from 'depack'

(async () => {
const res = await depack({
text: 'example',
})
console.log(res)
})()
```
```
example
```

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/2.svg?sanitize=true"></a></p>

## Copyright

(c) [Art Deco][1] 2018

[1]: https://artdeco.bz

<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/-1.svg?sanitize=true"></a></p>
30 changes: 30 additions & 0 deletions build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions documentary/1-API/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## API

The package is available by importing its default function:

```js
import depack from 'depack'
```

%~%

```## depack
[
["arg1", "string"],
["arg2?", "boolean"]
]
```

Call this function to get the result you want.

%TYPEDEF types/index.xml%

%EXAMPLE: example/example.js, ../src => depack%
%FORK example example/example%

%~%
11 changes: 11 additions & 0 deletions documentary/footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- ## TODO
- [ ] Add a new item to the todo list. -->

## Copyright

(c) [Art Deco][1] 2018

[1]: https://artdeco.bz

%~ -1%
15 changes: 15 additions & 0 deletions documentary/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# depack

%NPM: depack%

`depack` is Unpackager Of Dependencies To Create "Zero-Dependency Build" With Closure.

```sh
yarn add -E depack
```

## Table Of Contents

%TOC%

%~%
9 changes: 9 additions & 0 deletions example/example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* yarn example/ */
import depack from '../src'

(async () => {
const res = await depack({
text: 'example',
})
console.log(res)
})()
2 changes: 2 additions & 0 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('alamode')()
require(`../${process.argv[2]}`)
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "depack",
"version": "0.0.0",
"description": "Unpackager Of Dependencies To Create "Zero-Dependency Build" With Closure.",
"main": "build",
"scripts": {
"t": "zoroaster -a",
"test": "yarn t test/spec test/mask",
"spec": "yarn t test/spec",
"mask": "yarn t test/mask",
"test-build": "ALAMODE_ENV=test-build yarn test",
"lint": "eslint .",
"doc": "NODE_DEBUG=doc doc documentary -o README.md",
"b": "alamode src -o build",
"d": "yarn-s d1",
"d1": "NODE_DEBUG=doc doc src/index.js -g",
"build": "yarn-s d b doc",
"rec": "NODE_DEBUG=appshot appshot -T 23 -a Terminal -y 150 -f",
"e": "node example",
"example/": "yarn e example/example.js"
},
"files": [
"build"
],
"repository": {
"type": "git",
"url": "git://github.com/artdecocode/depack.git"
},
"keywords": [
"depack"
],
"author": "Anton <anton@adc.sh>",
"license": "MIT",
"bugs": {
"url": "https://github.com/artdecocode/depack/issues"
},
"homepage": "https://github.com/artdecocode/depack#readme",
"devDependencies": {
"alamode": "1.5.1",
"documentary": "1.20.1",
"eslint-config-artdeco": "1.0.1",
"yarn-s": "1.1.0",
"zoroaster": "3.5.2"
}
}
26 changes: 26 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { debuglog } from 'util'

const LOG = debuglog('depack')

/**
* Unpackager Of Dependencies To Create "Zero-Dependency Build" With Closure.
* @param {Config} [config] Options for the program.
* @param {boolean} [config.shouldRun=true] A boolean option. Default `true`.
* @param {string} config.text A text to return.
*/
export default async function depack(config = {}) {
const {
shouldRun = true,
text,
} = config
if (!shouldRun) return
LOG('depack called with %s', text)
return text
}

/* documentary types/index.xml */
/**
* @typedef {Object} Config Options for the program.
* @prop {boolean} [shouldRun=true] A boolean option. Default `true`.
* @prop {string} text A text to return.
*/
Loading

0 comments on commit fe94112

Please sign in to comment.