-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/particle 11 add typescript, jest, tweak lerna, and update rea…
…dme (#849) * add learn:bootstrap command and update readme with tutorial on how to get started * set nvm to node 12 * * add typescript compilation * add jest and configure for supporting both ts and js files * swap create from js to ts and use es6 default export * fix update:check and update:start scripts to use concurrency 1 allowing clearer update messages and for the cli to work on the update:start script * update packages to latest dependency versions * add tutorial for dev install and remove clean script. Add clean script directly into readme for how to quickly remove all package-lock.json files if you npm install anything * WIP fix bin npm link inside of dist * remove bin file from root particle library, add json and .md file copying using a src/scripts/build.ts file to copy files * convert js files to ts * clean up logs and change require to import * update readme regarding installing a dependency via npm link
- Loading branch information
1 parent
6e0d54d
commit e19f84f
Showing
20 changed files
with
220 additions
and
50 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 +1 @@ | ||
10 | ||
12 |
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,20 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
useBuiltIns: 'entry', | ||
target: { node: 12 }, | ||
}, | ||
], | ||
'@babel/preset-typescript', | ||
], | ||
env: { | ||
test: { | ||
presets: [['@babel/preset-env']], | ||
}, | ||
production: { | ||
plugins: ['transform-remove-console'], | ||
}, | ||
}, | ||
} |
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,20 @@ | ||
module.exports = { | ||
displayName: 'Particle CJS', | ||
verbose: true, | ||
preset: 'ts-jest', | ||
moduleFileExtensions: ['js', 'ts', 'json'], | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.(ts)$': 'ts-jest', | ||
}, | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: true, // allows for type checking. Set to false only if you need to debug something quickly | ||
tsConfig: 'tsconfig.json', | ||
}, | ||
}, | ||
watchPlugins: [ | ||
'jest-watch-typeahead/filename', | ||
'jest-watch-typeahead/testname', | ||
], | ||
} |
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
File renamed without changes.
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
File renamed without changes.
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,10 @@ | ||
import create from '../lib/create' | ||
import repoPackage from '../package.json' | ||
|
||
const { name } = repoPackage | ||
|
||
describe(`${name}/create`, () => { | ||
it('show log', () => { | ||
expect(create()).toBeTruthy() | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
#!/usr/bin/env node | ||
|
||
const program = require('commander') | ||
// const pkg = require('../package'); // can't do since this is not copied over into dist unless its an import | ||
import pkg from '../package.json' | ||
const create = require('../lib/create') | ||
|
||
/** | ||
* Initialize Commander program with version. | ||
*/ | ||
program.version(pkg.version, '-V, --version') | ||
|
||
program | ||
.command('create') | ||
.alias('init') | ||
.description('Scaffold your project from a set of prompts.') | ||
.action(function () { | ||
// @TODO Implement Create Function. | ||
create() | ||
}) | ||
|
||
// allow commander to parse `process.argv` | ||
program.parse(process.argv) |
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
File renamed without changes.
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,34 @@ | ||
import fs from 'fs' | ||
import { exec } from 'child_process' | ||
|
||
const distFolder = './dist' // add your scripts to folder named scripts | ||
const packagesFolder = './packages' | ||
const files = fs.readdirSync(distFolder) // reading files from folders | ||
|
||
enum CopyFiles { | ||
README = 'README.md', | ||
PACKAGE = 'package.json', | ||
} | ||
|
||
/** | ||
* iterates through all dist packages and references the dist folder to the packages folder and grabs files unrelated to JS or TS that are required for publishing the package | ||
* */ | ||
|
||
files.forEach((packageName: string) => { | ||
const path = `${packagesFolder}/${packageName}` | ||
const b = fs.readdirSync(path).forEach((item: string) => { | ||
if (item === CopyFiles.README || item === CopyFiles.PACKAGE) { | ||
exec( | ||
`cp ${path}/${item} ${distFolder}/${packageName}/${item}`, | ||
{ shell: '/bin/bash' }, | ||
(err: any, stdout: any, stderr: any) => { | ||
console.log( | ||
`successfully wrote ${path}/${item} to dist`, | ||
stdout, | ||
stderr | ||
) | ||
} | ||
) | ||
} | ||
}) | ||
}) |
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,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"target": "ES2020", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"outDir": "dist", | ||
"allowJs": true, | ||
"resolveJsonModule": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"declaration": true, | ||
"noImplicitAny": true | ||
}, | ||
"include": ["packages/**/*"], | ||
"exclude": ["node_modules", "**/__tests__/*"] | ||
} |