Skip to content

Commit

Permalink
Implement the export of types
Browse files Browse the repository at this point in the history
  • Loading branch information
pepicrft committed Jan 11, 2022
1 parent a44daeb commit 064ea2d
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 5 deletions.
3 changes: 0 additions & 3 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
console.log('hello world');

console.log("something")
1 change: 1 addition & 0 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"include": ["./src/**/*.ts"],
"exclude": ["./dist"],
"references": [
{ "path": "../core" },
]
}
32 changes: 32 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@shopify/shopify-cli-core",
"version": "0.5.0",
"description": "A CLI tool to build for the Shopify platform",
"keywords": [
"shopify",
"shopify-cli",
"shopify-cli-core"
],
"license": "MIT",
"private": false,
"scripts": {
"test": "vitest run",
"test:watch": "vitest",
"build": "rimraf dist && rollup -c",
"build:watch": "rollup -c --watch --watch.include=src/**",
"shopify": "rollup -c --plugin @rollup/plugin-run",
"lint": "prettier -c src/** && eslint src/**",
"lint:fix": "prettier src/** && eslint src/** --fix",
"tsc": "tsc --noEmit"
},
"type": "module",
"dependencies": {
},
"devDependencies": {},
"peerDependencies": {},
"files": [
"dist",
"*.d.ts",
"*.mjs"
]
}
50 changes: 50 additions & 0 deletions packages/core/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import esbuild from 'rollup-plugin-esbuild';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import pkg from './package.json';
import dts from 'rollup-plugin-dts'

const entry = ['src/index.ts'];

const external = [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
];

export default ({ watch }) => [
{
input: entry,
output: {
dir: 'dist',
format: 'esm',
sourcemap: 'inline',
},
external,
plugins: [
resolve({
preferBuiltins: true,
}),
json(),
commonjs(),
esbuild({
target: 'node12',
}),
],
onwarn(message) {
if (/Circular dependencies/.test(message)) return;
console.error(message);
},
},
{
input: entry,
output: {
file: 'dist/index.d.ts',
format: 'esm',
},
external,
plugins: [
dts(),
],
}
];
5 changes: 5 additions & 0 deletions packages/core/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { assert, expect, it, suite, test } from 'vitest';

test('it works', () => {
expect(true).toBeTruthy();
});
7 changes: 7 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface User {
name: string
}

export default function (): User {
return {name: "Pedro"}
}
7 changes: 7 additions & 0 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../configurations/tsconfig.json",
"include": ["./src/**/*.ts"],
"exclude": ["./dist"],
"references": [
]
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"references": [
{ "path": "packages/cli" }
{ "path": "./packages/core" },
{ "path": "./packages/cli" }
],
"files": []
}

0 comments on commit 064ea2d

Please sign in to comment.