Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
filoxo committed Jul 21, 2020
0 parents commit 1477f7a
Show file tree
Hide file tree
Showing 15 changed files with 6,460 additions and 0 deletions.
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

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

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

esm
system
7 changes: 7 additions & 0 deletions .kodiak.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# .kodiak.toml
# Minimal config. version is the only required field.
version = 1
approve.auto_approve_usernames = [ "renovate" ]
merge.method = "squash"
merge.delete_branch_on_merge = true
merge.require_automerge_label = false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.prettierignore
.gitignore
LICENSE
yarn.lock
yarn-error.log
esm/
system/
.DS_Store
.kodiak.toml
karma.conf.cjs
.nvmrc
11 changes: 11 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"github": {
"release": true
},
"publishConfig": {
"access": "public"
},
"plugins": {
"release-it-plugin-esm-bundle": {}
}
}
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
node_js:
- node
env:
global:
- MOZ_HEADLESS=1
addons:
firefox: latest
script: yarn test
deploy:
provider: script
script: git remote remove origin && git remote add origin https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/$TRAVIS_REPO_SLUG && git symbolic-ref HEAD refs/heads/master && git fetch origin && git branch -u origin/master && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc && npm run release
skip_cleanup: true
on:
branch: master
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 esm-bundle

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# autopublish-template

[![npm version](https://img.shields.io/npm/v/@esm-bundle/autopublish-template.svg?style=flat)](https://www.npmjs.com/package/@esm-bundle/autopublish-template) [![build status](https://travis-ci.com/esm-bundle/autopublish-template.svg?branch=master)](https://travis-ci.com/esm-bundle/autopublish-template) [![](https://data.jsdelivr.com/v1/package/npm/@esm-bundle/autopublish-template/badge)](https://www.jsdelivr.com/package/npm/@esm-bundle/autopublish-template)

["What is this" blog post](https://medium.com/@joeldenning/an-esm-bundle-for-any-npm-package-5f850db0e04d)

[Instructions for creating a new esm-bundle repo](https://github.com/esm-bundle/new-repo-instructions)

A repo that tests automatic detection of upstream publishes and the publishing of `@esm-bundle` versions of them.

Upstream repo at https://github.com/joeldenning/autopublish-template.

## JS Delivr

https://cdn.jsdelivr.net/npm/@esm-bundle/autopublish-template/esm/index.js

https://cdn.jsdelivr.net/npm/@esm-bundle/autopublish-template/system/index.js

## Unpkg

https://unpkg.com/@esm-bundle/autopublish-template/esm/index.js

https://unpkg.com/@esm-bundle/autopublish-template/system/index.js

## Npm

```sh
npm install --save autopublish-template@npm:@esm-bundle/autopublish-template
```

## Yarn

```sh
yarn add autopublish-template@npm:@esm-bundle/autopublish-template
```
9 changes: 9 additions & 0 deletions browser-test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe("@esm-bundle/autopublish-template", () => {
it("can load the ESM bundle", () => {
return import("/base/esm/index.js");
});

it("can load the System.register bundle", () => {
return System.import("/base/system/index.js");
});
});
59 changes: 59 additions & 0 deletions karma.conf.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Karma configuration
// Generated on Tue Jan 28 2020 17:24:56 GMT-0700 (Mountain Standard Time)

module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["jasmine"],

// list of files / patterns to load in the browser
files: [
"https://cdn.jsdelivr.net/npm/systemjs/dist/system.js",
{ pattern: "browser-test/**/*.js", watched: true, type: "module" },
{ pattern: "./**/*.*", watched: true, included: false, served: true }
],

urlRoot: "/",

// list of files / patterns to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["progress"],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ["Firefox"],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
};
5 changes: 5 additions & 0 deletions node-test/main.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("@esm-bundle/autopublish-template", () => {
it("can load the esm bundle without dying", () => {
return import("../esm/index.js");
});
});
42 changes: 42 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@esm-bundle/autopublish-template",
"version": "20.0.0",
"description": "Repo to test esm-bundle's automatic publishing",
"main": "index.js",
"module": "esm/index.js",
"type": "module",
"scripts": {
"test": "yarn build && concurrently -n w: 'yarn:test:*'",
"test:browser": "karma start karma.conf.cjs --single-run",
"debug:test:browser": "karma start karma.conf.cjs",
"test:unit": "mocha -r chai/register-expect 'node-test/**/*.*'",
"test:formatting": "prettier --check './**/*'",
"build": "rollup -c",
"format": "prettier --write './**/*'",
"release": "release-it",
"prepublishOnly": "yarn build"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged && yarn test"
}
},
"files": [
"esm",
"system"
],
"repository": {
"type": "git",
"url": "git+https://github.com/esm-bundle/autopublish-template.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/esm-bundle/autopublish-template/issues"
},
"homepage": "https://github.com/esm-bundle/autopublish-template#readme",
"devDependencies": {
"autopublish-template": "20.0.0",
"esm-bundle-scripts": "1.2.0"
}
}
3 changes: 3 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["config:base"]
}
17 changes: 17 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";

function createConfig(format) {
const dir = format === "module" ? "esm" : format;
return {
input: require.resolve("autopublish-template"),
output: {
file: `${dir}/index.js`,
sourcemap: true,
format,
},
plugins: [commonjs(), terser()],
};
}

export default [createConfig("module"), createConfig("system")];
Loading

0 comments on commit 1477f7a

Please sign in to comment.