Skip to content

Instantly share code, notes, and snippets.

@ovrmrw
Last active July 16, 2016 12:00
Show Gist options
  • Save ovrmrw/427a3961c27292e27493c8e056c2489b to your computer and use it in GitHub Desktop.
Save ovrmrw/427a3961c27292e27493c8e056c2489b to your computer and use it in GitHub Desktop.
Copy *.ts and *.d.ts files from ./jspm_packages/npm/ to ./node_modules/@types/
/*
Copy *.ts and *.d.ts files from ./jspm_packages/npm/ to ./node_modules/@types/
This tool is for TypeScript 2.0.
*/
const lodash = require('lodash');
const fs = require('fs-extra');
const path = require('path');
const root = path.resolve();
require('./jspm_packages/system.src'); // SystemJS
require('./jspm.config'); // jspm config file
console.log(SystemJS.map);
lodash.forEach(SystemJS.map, (value, key) => {
const npm = value.split(':')[0];
if (npm === 'npm') {
console.log(key); // @angular/core
const path = value.replace(':', '/');
console.log(path); // npm/@angular/[email protected]
fs.copySync(root + '/jspm_packages/' + path, root + '/node_modules/@types/' + key, { filter: /\.ts/ });
}
});
@ovrmrw
Copy link
Author

ovrmrw commented Jul 15, 2016

Greate work!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment