Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #235 from glimmerjs/glimmerjs-2.0
Browse files Browse the repository at this point in the history
[BREAKING] Glimmer.js 2.0
  • Loading branch information
rwjblue authored Feb 11, 2020
2 parents 980a02a + 35c7fb9 commit cd4b923
Show file tree
Hide file tree
Showing 271 changed files with 9,709 additions and 13,964 deletions.
19 changes: 19 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# compiled output
**/dist/**
**/tmp/**

# dependencies
/bower_components/
/node_modules/

**/node_modules/**
**/bower_components/**

# These are fixtures for tests, should be ignored
typescript.ts
babel.js

**/fixtures/**/*.js
**/fixture-options/**/*.js

test/types/utils.ts
73 changes: 73 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
},
extends: [
'eslint:recommended',
'prettier',
],
plugins: ['@typescript-eslint', 'prettier'],
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.babelrc.js',
'standalone.js',
'**/testem.js',
'**/config/ember-try.js',
'**/config/environment.js',
'**/config/targets.js',
'**/ember-cli-build.js',
'**/ember-addon-main.js',
'**/bin/**/*.js',
'**/scripts/**/*.js',
'**/blueprints/**/*.js',
'webpack.config.js',
'packages/babel-plugins/**/*.js',
'packages/@glimmer/blueprint/index.js',
],
env: {
es6: true,
node: true,
},
},
// bin scripts
{
files: ['bin/**/*.js'],
rules: {
'no-process-exit': 'off',
},
},
// source Js
{
files: ['src/**/*.js'],
parserOptions: {
sourceType: 'module',
},
},
// TypeScript source
{
files: ['**/*.ts'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

// disabling this one because of DEBUG APIs, if we ever find a better
// way to suport those we should re-enable it
'@typescript-eslint/no-non-null-assertion': 'off',

'@typescript-eslint/no-use-before-define': 'off',
}
},
],
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dist
/npm-debug.log*
/testem.log
/yarn-error.log
.eslintcache

# ember-try
**/.node_modules.ember-try/**
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '8'
- '10'

env:
- MOZ_HEADLESS=1
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
name: Package Tests
script: yarn test
- name: Lint
script: yarn tslint
script: yarn lint
- name: Type Lint
script:
- yarn build
Expand Down
3 changes: 0 additions & 3 deletions .watchmanconfig

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

71 changes: 71 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env node

const path = require('path');
const fs = require('fs-extra');
const { promisify } = require('util');

const exec = promisify(require('child_process').exec);
const glob = promisify(require('glob'));

(async function() {
process.chdir(path.join(__dirname, '..'));

await buildTypescript('dist/modules', 'es2015');
await buildTypescript('dist/commonjs', 'commonjs');

const packages = (await glob('dist/modules/{@*/*,!(@*)}'))
.map(pkg => pkg.replace('dist/modules/', ''))
.flatMap(pkg => [
{
from: path.join('dist', 'commonjs', pkg),
to: path.join('packages', pkg, 'dist', 'commonjs'),
},
{
from: path.join('dist', 'modules', pkg),
to: path.join('packages', pkg, 'dist', 'modules'),
},
]);

await remove(packages.map(pkg => pkg.to));
await createDirs(packages.map(pkg => pkg.to));
await move(packages);

console.log('\n\nDone');
})();

async function buildTypescript(outDir, moduleKind = 'es2015') {
try {
await exec(`node_modules/.bin/tsc -p . --outDir ${outDir} -m ${moduleKind}`);
} catch (err) {
if (err.stdout) {
console.log(err.stdout.toString());
} else {
throw err;
}
}
}

function createDirs(paths) {
return each(paths, pathOfDir => {
console.log(`Creating Dir ${pathOfDir}`);
return fs.mkdirp(pathOfDir);
});
}

function remove(paths) {
return each(paths, pathOfDir => {
console.log(`Removing ${pathOfDir}`);
return fs.remove(pathOfDir);
});
}

function move(paths) {
return each(paths, ({ from, to }) => {
console.log(`Moving ${from} -> ${to}`);
return fs.rename(from, to);
});
}

function each(paths, cb) {
return Promise.all(paths.map(cb));
}
23 changes: 23 additions & 0 deletions bin/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node

const fs = require('fs-extra');
const { promisify } = require('util');

const glob = promisify(require('glob'));

(async function() {
await remove(await glob('./packages/@glimmer/*/dist'));

console.log('\n\nDone');
})();

function remove(paths) {
return each(paths, pathOfDir => {
console.log(`Removing ${pathOfDir}`);
return fs.remove(pathOfDir);
});
}

function each(paths, cb) {
return Promise.all(paths.map(cb));
}
Loading

0 comments on commit cd4b923

Please sign in to comment.