@atlaskit/adf-schema 38.0.0 → 39.0.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "38.0.0",
3
+ "version": "39.0.0",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -18,10 +18,6 @@
18
18
  "sideEffects": false,
19
19
  "scripts": {
20
20
  "clean:build": "rm -rf dist",
21
- "build:json-schema": "mkdir -p dist && cp -r json-schema dist",
22
- "generate:json-schema": "mkdir -p json-schema/v1/ && yarn generate:json-schema:full && yarn generate:json-schema:stage-0",
23
- "generate:json-schema:stage-0": "json-schema-generator --outDir=./json-schema/v1/ --stage=0 ./src/schema/nodes/doc.ts",
24
- "generate:json-schema:full": "json-schema-generator --outDir=./json-schema/v1/ ./src/schema/nodes/doc.ts",
25
21
  "ak-postbuild": "yarn build:json-schema",
26
22
  "test": "yarn test:unit",
27
23
  "test:unit": "yarn workspace @atlaskit/editor-prosemirror build && jest --testPathPattern=packages/adf-schema/ --config=../../jest.config.js",
@@ -32,11 +28,12 @@
32
28
  "build:types": "NODE_ENV=production tsc --project ./build/tsconfig.json --emitDeclarationOnly --outDir ./dist/types --rootDir ./src && yarn build:jsontypes",
33
29
  "build:jsontypes": "mkdir -p dist/types/json-schema && cp src/json-schema/index.ts dist/types/json-schema/index.d.ts",
34
30
  "build:all": "yarn build:cjs && yarn build:esm && yarn build:es2019 && yarn build:types",
35
- "build": "yarn clean:build && yarn workspace @atlaskit/editor-prosemirror build && yarn workspace @atlaskit/adf-schema-generator build && yarn run build:all && yarn run generate:json-schema && yarn run build:json-schema && yarn run build:pm:full",
36
- "build:pm:full": "yarn ts-node ./schema-generators/pm-full-schema.ts && prettier --write './src/next-schema/generated/**/*.ts'",
37
- "build:json:full": "yarn ts-node ./schema-generators/json-full-schema.ts && prettier --write './src/next-schema/generated/**/*.json'",
38
- "build:validator:full": "yarn ts-node ./schema-generators/validator-full-schema.ts && prettier --write './src/validator-schema/generated/**/*.ts'",
39
- "build:generated:full": "yarn build:pm:full && yarn build:json:full && yarn build:validator:full",
31
+ "build": "yarn clean:build && yarn workspace @atlaskit/editor-prosemirror build && yarn workspace @atlaskit/adf-schema-generator build && yarn run build:all && yarn run build:schema:all",
32
+ "build:move:json-schema": "mkdir -p dist && cp -r json-schema dist",
33
+ "build:schema:pm": "yarn ts-node ./schema-generators/pm-full-schema.ts && prettier --write './src/next-schema/generated/**/*.ts'",
34
+ "build:schema:json": "mkdir -p json-schema/v1/ && yarn ts-node ./schema-generators/json-full-schema.ts && prettier --write './json-schema/v1/*.json' && yarn run build:move:json-schema",
35
+ "build:schema:validator": "yarn ts-node ./schema-generators/validator-full-schema.ts && prettier --write './src/validator-schema/generated/**/*.ts'",
36
+ "build:schema:all": "yarn build:schema:pm && yarn build:schema:json && yarn build:schema:validator",
40
37
  "clean": "../../scripts/build-clean.sh",
41
38
  "link:afe": "yarn build:all && node ./copy-dist-to-afe.js"
42
39
  },
@@ -51,10 +48,9 @@
51
48
  "devDependencies": {
52
49
  "@atlassian/adf-schema-json": "^1.16.0",
53
50
  "@atlassian/feature-flags-test-utils": "^0.2.0",
54
- "@atlaskit/adf-schema-generator": "^1.27.0",
51
+ "@atlaskit/adf-schema-generator": "^1.28.0",
55
52
  "@atlaskit/adf-utils": "^19.2.2",
56
53
  "@atlaskit/codemod-utils": "^4.2.4",
57
- "@atlaskit/json-schema-generator": "^3.3.9",
58
54
  "@babel/cli": "^7.22.9",
59
55
  "@babel/core": "^7.22.9",
60
56
  "@babel/plugin-proposal-class-properties": "^7.18.6",
@@ -67,6 +63,7 @@
67
63
  "@babel/preset-react": "^7.18.6",
68
64
  "@babel/preset-typescript": "^7.22.5",
69
65
  "@compiled/babel-plugin": "0.15.0",
66
+ "@manypkg/find-root": "^1.1.0",
70
67
  "@types/jest": "^29.5.3",
71
68
  "@types/json-schema": "^7.0.15",
72
69
  "@types/linkify-it": "^2.0.4",
@@ -0,0 +1,24 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { findRootSync } from '@manypkg/find-root';
4
+
5
+ /**
6
+ * Writes a string to a file in `packages/adf-schema/src/${subfolder}/generated/${fileName}`
7
+ * @param fileName The name of the file - including file extension
8
+ * @param content The string containing the content of the file
9
+ * @param subpath The subfolder to use, by default it is `next-schema`
10
+ */
11
+ export function writeToFile(
12
+ fileName: string,
13
+ content: string,
14
+ subpath: string = 'next-schema',
15
+ ): void {
16
+ const filePath = path.join(
17
+ findRootSync(process.cwd()),
18
+ 'packages',
19
+ 'adf-schema',
20
+ subpath,
21
+ fileName,
22
+ );
23
+ fs.writeFileSync(filePath, content);
24
+ }
@@ -1,12 +1,16 @@
1
- import { adfToJSON, writeToFile } from '@atlaskit/adf-schema-generator';
2
- import adfNode from 'src/next-schema/full-schema.adf';
1
+ import path from 'path';
2
+ import { adfToJSON } from '@atlaskit/adf-schema-generator';
3
+ import adfNode from '../src/next-schema/full-schema.adf';
4
+ import { writeToFile } from './helpers/writeToFile';
5
+
6
+ const outputPath = path.join('json-schema', 'v1');
3
7
 
4
8
  function main() {
5
9
  const fullSchema = adfToJSON(adfNode, true);
6
10
  const stage0 = adfToJSON(adfNode, false);
7
11
 
8
- writeToFile('full.json', JSON.stringify(fullSchema));
9
- writeToFile('stage0.json', JSON.stringify(stage0));
12
+ writeToFile('full.json', JSON.stringify(fullSchema, null, 2), outputPath);
13
+ writeToFile('stage-0.json', JSON.stringify(stage0, null, 2), outputPath);
10
14
  }
11
15
 
12
16
  main();
@@ -1,12 +1,16 @@
1
- import { adfToPm, writeToFile } from '@atlaskit/adf-schema-generator';
1
+ import path from 'path';
2
+ import { adfToPm } from '@atlaskit/adf-schema-generator';
2
3
  import adfNode from 'src/next-schema/full-schema.adf';
4
+ import { writeToFile } from './helpers/writeToFile';
5
+
6
+ const outputPath = path.join('src', 'next-schema', 'generated');
3
7
 
4
8
  function main() {
5
9
  const output = adfToPm(adfNode);
6
10
 
7
- writeToFile('nodeTypes.ts', output.pmNodes);
8
- writeToFile('markTypes.ts', output.pmMarks);
9
- writeToFile('nodeGroupTypes.ts', output.pmNodeGroups);
11
+ writeToFile('nodeTypes.ts', output.pmNodes, outputPath);
12
+ writeToFile('markTypes.ts', output.pmMarks, outputPath);
13
+ writeToFile('nodeGroupTypes.ts', output.pmNodeGroups, outputPath);
10
14
  }
11
15
 
12
16
  main();
@@ -1,9 +1,10 @@
1
- import {
2
- adfToValidatorSpec,
3
- writeToFile,
4
- } from '@atlaskit/adf-schema-generator';
1
+ import path from 'path';
2
+ import { adfToValidatorSpec } from '@atlaskit/adf-schema-generator';
5
3
  import adfNode from 'src/next-schema/full-schema.adf';
6
4
  import { sortNestedArrays } from 'src/validator-schema/utils/sortNestedArrays';
5
+ import { writeToFile } from './helpers/writeToFile';
6
+
7
+ const outputPath = path.join('src', 'validator-schema', 'generated');
7
8
 
8
9
  function generateValidatorSpec() {
9
10
  const output = sortNestedArrays(adfToValidatorSpec(adfNode));
@@ -16,7 +17,7 @@ function generateValidatorSpec() {
16
17
 
17
18
  function main() {
18
19
  const spec = generateValidatorSpec();
19
- writeToFile('validatorSpec.ts', spec, 'validator-schema');
20
+ writeToFile('validatorSpec.ts', spec, outputPath);
20
21
  }
21
22
 
22
23
  main();