Skip to content

Commit

Permalink
Add fonts and fix resolveLoader configuration in Webpack (#58)
Browse files Browse the repository at this point in the history
* v0.1.5

* Format code

* Fixes modules resolving configuration in Webpack

* Fixes resolveLoader configuration in Webpack

* v0.1.7
  • Loading branch information
clitetailor authored Feb 13, 2022
1 parent d2ec9a6 commit 058ebd4
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 37 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/build",
"version": "0.1.4",
"version": "0.1.7",
"description": "The next generation markup language for everyone!",
"keywords": [
"text",
Expand Down Expand Up @@ -31,7 +31,7 @@
"coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage",
"add-license": "node scripts/add-license -f templates/Exhibit-A.ts packages/*/src/**/*.{ts,js} packages/*/*.{ts,js} *.{ts,js}",
"publish-all": "pnpm build && pnpm test && pnpm m --filter ./packages publish --access public --tag beta",
"bump-version": "node scripts/bump-version.js && pnpm format"
"bump-version": "node scripts/bump-version.js"
},
"devDependencies": {
"@types/jest": "^26.0.23",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/cli",
"version": "0.1.4",
"version": "0.1.7",
"description": "The Posttext CLI",
"type": "module",
"main": "index.js",
Expand Down Expand Up @@ -43,7 +43,7 @@
"boxen": "^5.0.1",
"chalk": "^4.1.1",
"chokidar": "^3.5.2",
"find-up": "^5.0.0",
"find-up": "^6.2.0",
"fs-extra": "^10.0.0",
"koa": "^2.13.1",
"koa-static": "^5.0.0",
Expand Down
15 changes: 9 additions & 6 deletions packages/cli/src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import fs from 'fs-extra'
import url from 'url'
import path from 'path'
import findUp from 'find-up'
import { findUpMultiple } from 'find-up'
import { Compiler } from '@posttext/compiler'
import { importMeta, StdModule } from '@posttext/modules'
import { getInterpreters } from '@posttext/interpreters/web'
Expand All @@ -30,10 +30,13 @@ export class CompileCommand implements Command {

const compiler = Compiler.create()

const pathToNodeModules = await findUp('node_modules', {
cwd: url.fileURLToPath(importMeta.url),
type: 'directory',
})
const pathsToNodeModules = await findUpMultiple(
'node_modules',
{
cwd: url.fileURLToPath(importMeta.url),
type: 'directory',
}
)

compiler
.getPrinter()
Expand All @@ -58,7 +61,7 @@ export class CompileCommand implements Command {
path.dirname(url.fileURLToPath(import.meta.url)),
'../node_modules'
),
...(pathToNodeModules ? [pathToNodeModules] : []),
...(pathsToNodeModules ? pathsToNodeModules : []),
],
},
})
Expand Down
15 changes: 9 additions & 6 deletions packages/cli/src/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import path from 'path'
import serve from 'koa-static'
import boxen from 'boxen'
import chalk from 'chalk'
import findUp from 'find-up'
import { findUpMultiple } from 'find-up'
import Router from '@koa/router'
import chokidar from 'chokidar'
import url from 'url'
Expand Down Expand Up @@ -119,10 +119,13 @@ export class ServeCommand implements Command {
): Promise<void> {
await fs.ensureDir(outputPath)

const pathToNodeModules = await findUp('node_modules', {
cwd: url.fileURLToPath(importMeta.url),
type: 'directory',
})
const pathsToNodeModules = await findUpMultiple(
'node_modules',
{
cwd: url.fileURLToPath(importMeta.url),
type: 'directory',
}
)

const interpreters = getInterpreters({
output: outputPath,
Expand All @@ -144,7 +147,7 @@ export class ServeCommand implements Command {
],
mode: 'development',
resolve: {
modules: pathToNodeModules ? [pathToNodeModules] : [],
modules: pathsToNodeModules ? pathsToNodeModules : [],
},
})

Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/compiler",
"version": "0.1.4",
"version": "0.1.7",
"description": "The compiler for Posttext",
"type": "module",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/interpreters/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/interpreters",
"version": "0.1.4",
"version": "0.1.7",
"description": "The backend interpreters for Posttext",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -39,7 +39,7 @@
"@posttext/parser": "workspace:*",
"@posttext/registry": "workspace:*",
"css-loader": "^5.2.6",
"find-up": "^5.0.0",
"find-up": "^6.2.0",
"fs-extra": "^10.0.0",
"handlebars": "^4.7.7",
"memoizee": "^0.4.15",
Expand Down
21 changes: 12 additions & 9 deletions packages/interpreters/src/web/interpreters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import fs from 'fs-extra'
import url from 'url'
import path from 'path'
import findUp from 'find-up'
import { findUpMultiple } from 'find-up'
import webpack from 'webpack'
import prettier from 'prettier'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
Expand Down Expand Up @@ -198,10 +198,13 @@ export const getInterpreters = ({
.map((dep) => dep.src)
.concat(externalCssDeps) as string[]

const pathToNodeModules = await findUp('node_modules', {
cwd: url.fileURLToPath(import.meta.url),
type: 'directory',
})
const pathsToNodeModules = await findUpMultiple(
'node_modules',
{
cwd: url.fileURLToPath(import.meta.url),
type: 'directory',
}
)

if (jsDeps.length + cssDeps.length > 0) {
const compiler = webpack({
Expand Down Expand Up @@ -238,17 +241,17 @@ export const getInterpreters = ({
},
resolve: {
modules: [
...(pathToNodeModules
? [pathToNodeModules]
...(pathsToNodeModules
? pathsToNodeModules
: []),
...new Set(resolve?.modules),
],
extensions: ['.ts', '.tsx', '.js', '.css'],
},
resolveLoader: {
modules: [
...(pathToNodeModules
? [pathToNodeModules]
...(pathsToNodeModules
? pathsToNodeModules
: []),
],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/modules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/modules",
"version": "0.1.4",
"version": "0.1.7",
"description": "The official modules for Posttext",
"type": "module",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/parser",
"version": "0.1.4",
"version": "0.1.7",
"description": "The parser for Posttext",
"type": "module",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/printer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/printer",
"version": "0.1.4",
"version": "0.1.7",
"description": "The printer for Posttext",
"type": "module",
"main": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/ptlib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/ptlib",
"version": "0.1.4",
"version": "0.1.7",
"description": "Utility library for Posttext modules",
"type": "module",
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/registry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@posttext/registry",
"version": "0.1.4",
"version": "0.1.7",
"description": "The library for registering modules in Posttext",
"type": "module",
"main": "index.js",
Expand Down
47 changes: 43 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 058ebd4

Please sign in to comment.