generated from fluture-js/fluture-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update distribution method for better browser support
See fluture-js/fluture-sanctuary-types#73 The main problem was the `.cjs` extensions, which confused content delivery networks. Simply changing the extension to `.js` won't work, because that'd confuse Node 12 and up. So besides changing the extension, the file has also been moved into a sub-directory containing a package.json file that tells newer Node versions that the files here are CommonJS (without the need for a file extension). This commit also adds documentation for the different ways that the module can now be obtained.
- Loading branch information
Showing
7 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/coverage/ | ||
/index.cjs | ||
/dist/* | ||
/node_modules/ | ||
|
||
!/dist/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
//. # Fluture Project | ||
//. | ||
//. Hopefully something related to Fluture. | ||
//. | ||
//. ## Usage | ||
//. | ||
//. ### Node | ||
//. | ||
//. ```console | ||
//. $ npm install --save fluture-project | ||
//. ``` | ||
//. | ||
//. On Node 12 and up, this module can be loaded directly with `import` or | ||
//. `require`. On Node versions below 12, `require` or the [esm][]-loader can | ||
//. be used. | ||
//. | ||
//. ### Deno and Modern Browsers | ||
//. | ||
//. You can load the EcmaScript module from various content delivery networks: | ||
//. | ||
//. - [Skypack](https://cdn.skypack.dev/[email protected]) | ||
//. - [JSPM](https://jspm.dev/[email protected]) | ||
//. - [jsDelivr](https://cdn.jsdelivr.net/npm/[email protected]/+esm) | ||
//. | ||
//. ### Old Browsers and Code Pens | ||
//. | ||
//. There's a [UMD][] file included in the NPM package, also available via | ||
//. jsDelivr: https://cdn.jsdelivr.net/npm/[email protected]/dist/umd.js | ||
//. | ||
//. This file adds `flutureProject` to the global scope, or use CommonJS/AMD | ||
//. when available. | ||
|
||
export default void 0; | ||
|
||
//. [esm]: https://github.com/standard-things/esm | ||
//. [UMD]: https://github.com/umdjs/umd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
import pkg from './package.json'; | ||
|
||
const dependencyNames = Array.prototype.concat.call ( | ||
Object.keys (pkg.dependencies), | ||
Object.keys (pkg.peerDependencies) | ||
); | ||
|
||
export default { | ||
input: 'index.js', | ||
external: dependencyNames, | ||
output: { | ||
format: 'umd', | ||
file: 'index.cjs', | ||
file: 'dist/umd.js', | ||
name: 'flutureProject', | ||
interop: false | ||
exports: 'named', | ||
globals: {} | ||
} | ||
}; |