@atlaskit/codemod-cli 0.10.1 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cli/package.json +8 -1
  3. package/dist/cjs/main.js +1 -1
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/es2019/version.json +1 -1
  6. package/dist/esm/main.js +1 -1
  7. package/dist/esm/version.json +1 -1
  8. package/dist/types-ts4.0/cli.d.ts +1 -0
  9. package/dist/types-ts4.0/filepath.d.ts +2 -0
  10. package/dist/types-ts4.0/index.d.ts +4 -0
  11. package/dist/types-ts4.0/main.d.ts +19 -0
  12. package/dist/types-ts4.0/presets/css-to-design-tokens/css-to-design-tokens.d.ts +2 -0
  13. package/dist/types-ts4.0/presets/css-to-design-tokens/utils/legacy-colors.d.ts +3 -0
  14. package/dist/types-ts4.0/presets/css-to-design-tokens/utils/meta.d.ts +1 -0
  15. package/dist/types-ts4.0/presets/index.d.ts +9 -0
  16. package/dist/types-ts4.0/presets/styled-to-emotion/styled-to-emotion.d.ts +6 -0
  17. package/dist/types-ts4.0/presets/theme-to-design-tokens/theme-to-design-tokens.d.ts +2 -0
  18. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/ast-meta.d.ts +3 -0
  19. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/ast.d.ts +3 -0
  20. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/color.d.ts +4 -0
  21. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/fuzzy-search.d.ts +5 -0
  22. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/legacy-colors.d.ts +3 -0
  23. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/named-colors.d.ts +1 -0
  24. package/dist/types-ts4.0/presets/theme-to-design-tokens/utils/tokens.d.ts +2 -0
  25. package/dist/types-ts4.0/sinceRef.d.ts +5 -0
  26. package/dist/types-ts4.0/transforms.d.ts +10 -0
  27. package/dist/types-ts4.0/types.d.ts +59 -0
  28. package/dist/types-ts4.0/utils.d.ts +1 -0
  29. package/filepath/package.json +8 -1
  30. package/main/package.json +8 -1
  31. package/package.json +11 -5
  32. package/report.api.md +30 -0
  33. package/sinceRef/package.json +8 -1
  34. package/transforms/package.json +8 -1
  35. package/types/package.json +8 -1
  36. package/utils/package.json +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/codemod-cli
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 0.10.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
14
+
3
15
  ## 0.10.1
4
16
 
5
17
  ### Patch Changes
package/cli/package.json CHANGED
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/cli.js",
4
4
  "module": "../dist/esm/cli.js",
5
5
  "module:es2019": "../dist/es2019/cli.js",
6
- "types": "../dist/types/cli.d.ts"
6
+ "types": "../dist/types/cli.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/cli.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }
package/dist/cjs/main.js CHANGED
@@ -387,7 +387,7 @@ function _main() {
387
387
  case 4:
388
388
  _yield$parseArgs = _context5.sent;
389
389
  packages = _yield$parseArgs.packages;
390
- _process$env$_PACKAGE = "0.10.1", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
390
+ _process$env$_PACKAGE = "0.10.3", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
391
391
  logger.log(_chalk.default.bgBlue(_chalk.default.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
392
392
 
393
393
  if (packages && packages.length > 0) {
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.10.1"
3
+ "version": "0.10.3"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.10.1"
3
+ "version": "0.10.3"
4
4
  }
package/dist/esm/main.js CHANGED
@@ -365,7 +365,7 @@ function _main() {
365
365
  case 4:
366
366
  _yield$parseArgs = _context5.sent;
367
367
  packages = _yield$parseArgs.packages;
368
- _process$env$_PACKAGE = "0.10.1", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
368
+ _process$env$_PACKAGE = "0.10.3", _PACKAGE_VERSION_ = _process$env$_PACKAGE === void 0 ? '0.0.0-dev' : _process$env$_PACKAGE;
369
369
  logger.log(chalk.bgBlue(chalk.black("\uD83D\uDCDA Atlassian-Frontend codemod library @ ".concat(_PACKAGE_VERSION_, " \uD83D\uDCDA"))));
370
370
 
371
371
  if (packages && packages.length > 0) {
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.10.1"
3
+ "version": "0.10.3"
4
4
  }
@@ -0,0 +1 @@
1
+ export declare function run(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ /** Return products packages filePaths for running codemods from specified dependent package */
2
+ export declare function findDependentPackagePaths(crawlPaths: string[], dependencyPackage: string): Promise<string[]>;
@@ -0,0 +1,4 @@
1
+ export { default } from './main';
2
+ export type { UserFlags } from './main';
3
+ export { ValidationError, NoTransformsExistError } from './types';
4
+ export type { Flags } from './types';
@@ -0,0 +1,19 @@
1
+ import { Flags, Default } from './types';
2
+ declare const defaultFlags: {
3
+ parser: "babel";
4
+ extensions: string;
5
+ ignorePattern: string;
6
+ logger: Console;
7
+ };
8
+ export declare type UserFlags = Default<Flags, keyof typeof defaultFlags>;
9
+ export default function main(input: string[], userFlags: UserFlags): Promise<{
10
+ transforms: {
11
+ module: string;
12
+ root: string;
13
+ dir: string;
14
+ base: string;
15
+ ext: string;
16
+ name: string;
17
+ }[];
18
+ }>;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FileInfo } from 'jscodeshift';
2
+ export default function transformer(file: FileInfo): Promise<string>;
@@ -0,0 +1,3 @@
1
+ export declare const knownVariables: Record<string, string[]>;
2
+ export declare const knownColors: Record<string, string[]>;
3
+ export declare const knownRawColors: Record<string, string[]>;
@@ -0,0 +1 @@
1
+ export declare function cleanMeta(meta: string[]): string[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Manually import presets to make sure typescript includes them
3
+ * in the final bundle
4
+ */
5
+ import './styled-to-emotion/styled-to-emotion';
6
+ import './theme-to-design-tokens/theme-to-design-tokens';
7
+ import './css-to-design-tokens/css-to-design-tokens';
8
+ declare const presets: string[];
9
+ export default presets;
@@ -0,0 +1,6 @@
1
+ import { FileInfo, API, Options } from 'jscodeshift';
2
+ /**
3
+ * Converts all imports of `styled-components` to `@emotion/styled`
4
+ */
5
+ export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options): string;
6
+ export declare const parser = "tsx";
@@ -0,0 +1,2 @@
1
+ import { API, FileInfo } from 'jscodeshift';
2
+ export default function transformer(file: FileInfo, api: API, debug?: boolean): string;
@@ -0,0 +1,3 @@
1
+ import core from 'jscodeshift';
2
+ export declare function getMetaFromAncestors(j: core.JSCodeshift, path: any, meta?: string[]): string[];
3
+ export declare function cleanMeta(meta: string[]): string[];
@@ -0,0 +1,3 @@
1
+ import core from 'jscodeshift';
2
+ export declare function isDecendantOfToken(j: core.JSCodeshift, path: any): boolean;
3
+ export declare function isDecendantOfType(j: core.JSCodeshift, path: any, type: any): boolean;
@@ -0,0 +1,4 @@
1
+ export declare const isLegacyColor: (value: string) => boolean;
2
+ export declare const isLegacyNamedColor: (value: string) => boolean;
3
+ export declare const includesHardCodedColor: (raw: string) => boolean;
4
+ export declare const isHardCodedColor: (value: string) => boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Fuzzy search ripped from the internet.
3
+ */
4
+ declare const FuzzySet: (arr?: string[], useLevenshtein?: boolean | undefined, gramSizeLower?: number, gramSizeUpper?: number) => any;
5
+ export default FuzzySet;
@@ -0,0 +1,3 @@
1
+ export declare const legacyColors: string[];
2
+ export declare const legacyColorMixins: string[];
3
+ export declare const legacyColorMetaMap: Record<string, string[]>;
@@ -0,0 +1 @@
1
+ export declare const namedColors: string[];
@@ -0,0 +1,2 @@
1
+ export declare const tokens: string[];
2
+ export declare const getUniqueWordsFromTokens: string[];
@@ -0,0 +1,5 @@
1
+ import { ParsedPkg } from './types';
2
+ /** Returns packages that have been upgraded in package.json since ref. The version refers to their previous
3
+ * version
4
+ */
5
+ export declare const getPackagesSinceRef: (ref: string) => Promise<ParsedPkg[]>;
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import path, { ParsedPath } from 'path';
3
+ import { ParsedPkg } from './types';
4
+ export declare const hasTransform: (transformPath: string) => boolean;
5
+ /** Retrieves transforms for `packages` if provided, otherwise all transforms including presets */
6
+ export declare const getTransforms: (packages?: ParsedPkg[] | undefined) => ParsedPath[];
7
+ export declare const parseTransformPath: (transformPath: string) => path.ParsedPath;
8
+ export declare const getTransformPath: ({ dir, base }: ParsedPath) => string;
9
+ export declare const getTransformModule: (transform: ParsedPath) => string;
10
+ export declare const getTransformVersion: (transform: ParsedPath) => string;
@@ -0,0 +1,59 @@
1
+ import { FileInfo, API, Options } from 'jscodeshift';
2
+ export declare type Transform = (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => string;
3
+ export declare type CliFlags = {
4
+ /**
5
+ * The transform to run
6
+ */
7
+ transform?: string;
8
+ /**
9
+ * select which transform to run
10
+ */
11
+ preset?: string;
12
+ /**
13
+ * Comma separated list of packages to run transforms for, @scope/package[@version]. If version is supplied, will only run transforms above that version
14
+ */
15
+ packages?: string;
16
+ /**
17
+ * Parser to use for parsing the source files
18
+ */
19
+ parser: 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx';
20
+ /**
21
+ * Transform files with these file extensions (comma separated list)
22
+ */
23
+ extensions: string;
24
+ /**
25
+ * Ignore files that match a provided glob expression
26
+ */
27
+ ignorePattern: string;
28
+ /**
29
+ * Determines changed packages since the specified git ref and runs all codemods for them. The ref can be any valid git ref, e.g. a commit hash, HEAD etc.
30
+ */
31
+ sinceRef?: string;
32
+ /**
33
+ * Return a 1 exit code when errors were found during execution of codemods
34
+ */
35
+ failOnError?: boolean;
36
+ /**
37
+ * Filters source paths to package directories that declare a dependency on the package being upgraded
38
+ */
39
+ filterPaths?: boolean;
40
+ };
41
+ export declare type Flags = CliFlags & {
42
+ logger: {
43
+ log: (...args: any) => void;
44
+ warn: (...args: any) => void;
45
+ };
46
+ };
47
+ export declare type ParsedPkg = {
48
+ name: string;
49
+ version: string | null;
50
+ };
51
+ /** Converts required args to optional if they have a default
52
+ * Example: export type UserFlags = Default<Flags, keyof typeof defaultFlags>;
53
+ */
54
+ export declare type Default<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
55
+ export declare type ValidateShape<T, Shape> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
56
+ export declare class ValidationError extends Error {
57
+ }
58
+ export declare class NoTransformsExistError extends Error {
59
+ }
@@ -0,0 +1 @@
1
+ export declare const fixLineEnding: (source: string, lineEnding: string) => string;
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/filepath.js",
4
4
  "module": "../dist/esm/filepath.js",
5
5
  "module:es2019": "../dist/es2019/filepath.js",
6
- "types": "../dist/types/filepath.d.ts"
6
+ "types": "../dist/types/filepath.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/filepath.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }
package/main/package.json CHANGED
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/main.js",
4
4
  "module": "../dist/esm/main.js",
5
5
  "module:es2019": "../dist/es2019/main.js",
6
- "types": "../dist/types/main.d.ts"
6
+ "types": "../dist/types/main.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/main.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/codemod-cli",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "A cli for distributing codemods for atlassian-frontend components and services",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -10,6 +10,13 @@
10
10
  "license": "Apache-2.0",
11
11
  "main": "index.js",
12
12
  "types": "dist/types/index.d.ts",
13
+ "typesVersions": {
14
+ ">=4.0 <4.5": {
15
+ "*": [
16
+ "dist/types-ts4.0/*"
17
+ ]
18
+ }
19
+ },
13
20
  "atlaskit:src": "src/index.ts",
14
21
  "atlassian": {
15
22
  "team": "Design System Team",
@@ -26,9 +33,8 @@
26
33
  "dependencies": {
27
34
  "@atlaskit/tokens": "^0.10.0",
28
35
  "@babel/runtime": "^7.0.0",
29
- "@types/chalk": "^2.2.0",
30
36
  "@types/jscodeshift": "^0.11.0",
31
- "chalk": "^2.1.0",
37
+ "chalk": "^4.1.2",
32
38
  "enquirer": "^2.3.4",
33
39
  "glob": "^7.1.2",
34
40
  "jscodeshift": "^0.13.0",
@@ -42,8 +48,8 @@
42
48
  "devDependencies": {
43
49
  "@atlaskit/docs": "*",
44
50
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
45
- "ts-node": "^10.0.0",
46
- "typescript": "4.2.4"
51
+ "ts-node": "^10.9.1",
52
+ "typescript": "4.5.5"
47
53
  },
48
54
  "homepage": "https://atlaskit.atlassian.com/packages/monorepo-tooling/codemod-cli",
49
55
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
package/report.api.md CHANGED
@@ -2,7 +2,37 @@
2
2
 
3
3
  > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
4
 
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
8
+
9
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
10
+
5
11
  ```ts
12
+ // @public (undocumented)
13
+ type CliFlags = {
14
+ transform?: string;
15
+ preset?: string;
16
+ packages?: string;
17
+ parser: 'babel' | 'babylon' | 'flow' | 'ts' | 'tsx';
18
+ extensions: string;
19
+ ignorePattern: string;
20
+ sinceRef?: string;
21
+ failOnError?: boolean;
22
+ filterPaths?: boolean;
23
+ };
24
+
25
+ // @public
26
+ type Default<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
27
+
28
+ // @public (undocumented)
29
+ const defaultFlags: {
30
+ parser: 'babel';
31
+ extensions: string;
32
+ ignorePattern: string;
33
+ logger: Console;
34
+ };
35
+
6
36
  // @public (undocumented)
7
37
  type Flags_2 = CliFlags & {
8
38
  logger: {
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/sinceRef.js",
4
4
  "module": "../dist/esm/sinceRef.js",
5
5
  "module:es2019": "../dist/es2019/sinceRef.js",
6
- "types": "../dist/types/sinceRef.d.ts"
6
+ "types": "../dist/types/sinceRef.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/sinceRef.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/transforms.js",
4
4
  "module": "../dist/esm/transforms.js",
5
5
  "module:es2019": "../dist/es2019/transforms.js",
6
- "types": "../dist/types/transforms.d.ts"
6
+ "types": "../dist/types/transforms.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/transforms.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/types.js",
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
- "types": "../dist/types/types.d.ts"
6
+ "types": "../dist/types/types.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/types.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }
@@ -3,5 +3,12 @@
3
3
  "main": "../dist/cjs/utils.js",
4
4
  "module": "../dist/esm/utils.js",
5
5
  "module:es2019": "../dist/es2019/utils.js",
6
- "types": "../dist/types/utils.d.ts"
6
+ "types": "../dist/types/utils.d.ts",
7
+ "typesVersions": {
8
+ ">=4.0 <4.5": {
9
+ "*": [
10
+ "../dist/types-ts4.0/utils.d.ts"
11
+ ]
12
+ }
13
+ }
7
14
  }