Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CJS projects #2487

Merged
merged 26 commits into from
Jul 13, 2022
Merged

Add support for CJS projects #2487

merged 26 commits into from
Jul 13, 2022

Conversation

wirednkod
Copy link
Contributor

@wirednkod wirednkod commented Jul 8, 2022

This PR adds support to Smoldot Light Client for CommonJS projects.
i) New TsConfigs were created for supporting/building the separated "projects" of ESM and CJS with a common tsconfig for avoiding duplicate configuration.

ii) More scripts and configuration have been added to package.json for supporting CJS

iii) A new script called fix-package-type which must run after build - does 2 things:
a) creates for each of the aforementioned directory a package.json file that contains the type of the project (a type with module and commonjs accordingly for MJS and CJS projects).

@wirednkod wirednkod requested a review from tomaka as a code owner July 8, 2022 20:17
wirednkod added 3 commits July 9, 2022 17:56
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.02s. with npm <command>

Usage:

npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term>
npm help npm       more involved overview

All commands:

    access, adduser, audit, bin, bugs, cache, ci, completion,
    config, dedupe, deprecate, diff, dist-tag, docs, doctor,
    edit, exec, explain, explore, find-dupes, fund, get, help,
    hook, init, install, install-ci-test, install-test, link,
    ll, login, logout, ls, org, outdated, owner, pack, ping,
    pkg, prefix, profile, prune, publish, rebuild, repo,
    restart, root, run-script, search, set, set-script,
    shrinkwrap, star, stars, start, stop, team, test, token,
    uninstall, unpublish, unstar, update, version, view, whoami

Specify configs in the ini-formatted file:
    /home/wirednkod/.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

[email protected] /home/wirednkod/.nvm/versions/node/v17.6.0/lib/node_modules/npm
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.02s. with npm <command>

Usage:

npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term>
npm help npm       more involved overview

All commands:

    access, adduser, audit, bin, bugs, cache, ci, completion,
    config, dedupe, deprecate, diff, dist-tag, docs, doctor,
    edit, exec, explain, explore, find-dupes, fund, get, help,
    hook, init, install, install-ci-test, install-test, link,
    ll, login, logout, ls, org, outdated, owner, pack, ping,
    pkg, prefix, profile, prune, publish, rebuild, repo,
    restart, root, run-script, search, set, set-script,
    shrinkwrap, star, stars, start, stop, team, test, token,
    uninstall, unpublish, unstar, update, version, view, whoami

Specify configs in the ini-formatted file:
    /home/wirednkod/.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

[email protected] /home/wirednkod/.nvm/versions/node/v17.6.0/lib/node_modules/npm
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.02s. with npm <command>

Usage:

npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term>
npm help npm       more involved overview

All commands:

    access, adduser, audit, bin, bugs, cache, ci, completion,
    config, dedupe, deprecate, diff, dist-tag, docs, doctor,
    edit, exec, explain, explore, find-dupes, fund, get, help,
    hook, init, install, install-ci-test, install-test, link,
    ll, login, logout, ls, org, outdated, owner, pack, ping,
    pkg, prefix, profile, prune, publish, rebuild, repo,
    restart, root, run-script, search, set, set-script,
    shrinkwrap, star, stars, start, stop, team, test, token,
    uninstall, unpublish, unstar, update, version, view, whoami

Specify configs in the ini-formatted file:
    /home/wirednkod/.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

[email protected] /home/wirednkod/.nvm/versions/node/v17.6.0/lib/node_modules/npm
@github-actions
Copy link
Contributor

github-actions bot commented Jul 9, 2022

twiggy diff report

Difference in .wasm size before and after this pull request.


 Delta Bytes │ Item
─────────────┼──────────────────
          +0 ┊ Σ [0 Total Rows]

yarn.lock Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
@wirednkod wirednkod requested a review from tomaka July 11, 2022 09:02
bin/wasm-node/CHANGELOG.md Outdated Show resolved Hide resolved
bin/wasm-node/CHANGELOG.md Outdated Show resolved Hide resolved
bin/wasm-node/javascript/fix-package-type Outdated Show resolved Hide resolved
bin/wasm-node/javascript/package.json Outdated Show resolved Hide resolved
bin/wasm-node/javascript/package.json Outdated Show resolved Hide resolved
bin/wasm-node/javascript/tsconfig-cjs.json Outdated Show resolved Hide resolved
bin/wasm-node/javascript/package.json Outdated Show resolved Hide resolved
bin/wasm-node/javascript/demo/demo.mjs Outdated Show resolved Hide resolved
@wirednkod wirednkod requested a review from tomaka July 13, 2022 12:03
@wirednkod wirednkod requested a review from tomaka July 13, 2022 15:10
@wirednkod wirednkod requested a review from tomaka July 13, 2022 15:54
@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Jul 13, 2022
@mergify mergify bot merged commit f27ec82 into paritytech:main Jul 13, 2022
@wirednkod wirednkod deleted the nik-add-cjs-support branch July 13, 2022 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge pull request as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants