Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "ianstormtaylor/slate" }
],
"changelog": ["@changesets/changelog-github", { "repo": "deepnote/slate" }],
"commit": false,
"linked": [["slate", "slate-history", "slate-hyperscript", "slate-react"]],
"linked": [
[
"@deepnote/slate",
"@deepnote/slate-history",
"@deepnote/slate-hyperscript",
"@deepnote/slate-react"
]
],
"access": "public",
"baseBranch": "deepnote",
"updateInternalDependencies": "patch",
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
key: node16
node-version: 18.x

- name: Run ${{ matrix.command }}
run: yarn && yarn build && yarn ${{ matrix.command }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [ deepnote ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [ deepnote ]
schedule:
- cron: '16 22 * * 3'

Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request &&
github.event.sender.login == 'ianstormtaylor' &&
(github.event.sender.login == 'ianstormtaylor' || github.event.sender.login == 'saltenas') &&
startsWith(github.event.comment.body, '/release:next')
steps:
- name: Checkout repo
Expand All @@ -45,10 +45,8 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
node-version: 18.x
registry-url: https://registry.npmjs.org
key: node16

- name: Install dependencies
run: yarn
Expand All @@ -67,11 +65,11 @@ jobs:

- name: Get released version
id: version
run: echo ::set-output name=version::$(node -p "require('./packages/slate/package.json').version")
run: echo "version=$(node -p \"require('./packages/slate/package.json').version\")" >> $GITHUB_OUTPUT

- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: |
A new release has been made for this pull request. You can install it with `yarn add slate@${{ steps.version.outputs.version }}`.
A new release has been made for this pull request. You can install it with `yarn add @deepnote/slate@${{ steps.version.outputs.version }}`.
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
branches:
- main
- deepnote

jobs:
release:
Expand All @@ -25,10 +25,8 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
node-version: 18.x
registry-url: https://registry.npmjs.org
key: node16

- name: Install dependencies
run: yarn
Expand Down
17 changes: 17 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,21 @@ module.exports = {
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-react',
],
plugins: [
[
'module-resolver',
{
alias: {
'slate': './packages/slate/src',
'slate-history': './packages/slate-history/src',
'slate-hyperscript': './packages/slate-hyperscript/src',
'slate-react': './packages/slate-react/src',
'@deepnote/slate': './packages/slate/src',
'@deepnote/slate-history': './packages/slate-history/src',
'@deepnote/slate-hyperscript': './packages/slate-hyperscript/src',
'@deepnote/slate-react': './packages/slate-react/src',
},
},
],
],
}
16 changes: 9 additions & 7 deletions config/rollup/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ function configure(pkg, env, target) {
const isUmd = target === 'umd'
const isModule = target === 'module'
const isCommonJs = target === 'cjs'
const input = `packages/${pkg.name}/src/index.ts`
// Strip scope from package name for directory paths (@deepnote/slate -> slate)
const pkgDir = pkg.name.replace(/^@[^/]+\//, '')
const input = `packages/${pkgDir}/src/index.ts`
const deps = []
.concat(pkg.dependencies ? Object.keys(pkg.dependencies) : [])
.concat(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [])
Expand All @@ -44,7 +46,7 @@ function configure(pkg, env, target) {

typescript({
abortOnError: false,
tsconfig: `./packages/${pkg.name}/tsconfig.json`,
tsconfig: `./packages/${pkgDir}/tsconfig.json`,
// COMPAT: Without this flag sometimes the declarations are not updated.
// clean: isProd ? true : false,
clean: true,
Expand All @@ -53,7 +55,7 @@ function configure(pkg, env, target) {
// Allow Rollup to resolve CommonJS modules, since it only resolves ES2015
// modules by default.
commonjs({
exclude: [`packages/${pkg.name}/src/**`],
exclude: [`packages/${pkgDir}/src/**`],
// HACK: Sometimes the CommonJS plugin can't identify named exports, so
// we have to manually specify named exports here for them to work.
// https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports
Expand All @@ -78,7 +80,7 @@ function configure(pkg, env, target) {
// Use Babel to transpile the result, limiting it to the source code.
babel({
runtimeHelpers: true,
include: [`packages/${pkg.name}/src/**`],
include: [`packages/${pkgDir}/src/**`],
extensions: ['.js', '.ts', '.tsx'],
presets: [
'@babel/preset-typescript',
Expand Down Expand Up @@ -128,7 +130,7 @@ function configure(pkg, env, target) {
onwarn,
output: {
format: 'umd',
file: `packages/${pkg.name}/${isProd ? pkg.umdMin : pkg.umd}`,
file: `packages/${pkgDir}/${isProd ? pkg.umdMin : pkg.umd}`,
exports: 'named',
name: startCase(pkg.name).replace(/ /g, ''),
globals: pkg.umdGlobals,
Expand All @@ -144,7 +146,7 @@ function configure(pkg, env, target) {
onwarn,
output: [
{
file: `packages/${pkg.name}/${pkg.main}`,
file: `packages/${pkgDir}/${pkg.main}`,
format: 'cjs',
exports: 'named',
sourcemap: true,
Expand All @@ -166,7 +168,7 @@ function configure(pkg, env, target) {
onwarn,
output: [
{
file: `packages/${pkg.name}/${pkg.module}`,
file: `packages/${pkgDir}/${pkg.module}`,
format: 'es',
sourcemap: true,
},
Expand Down
10 changes: 10 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ const config = {
},
},
testEnvironment: 'jsdom',
moduleNameMapper: {
'^slate$': '<rootDir>/packages/slate/src',
'^slate-history$': '<rootDir>/packages/slate-history/src',
'^slate-hyperscript$': '<rootDir>/packages/slate-hyperscript/src',
'^slate-react$': '<rootDir>/packages/slate-react/src',
'^@deepnote/slate$': '<rootDir>/packages/slate/src',
'^@deepnote/slate-history$': '<rootDir>/packages/slate-history/src',
'^@deepnote/slate-hyperscript$': '<rootDir>/packages/slate-hyperscript/src',
'^@deepnote/slate-react$': '<rootDir>/packages/slate-react/src',
},
Comment on lines +10 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Module mappings support dual package names during migration—consider future cleanup.

The moduleNameMapper correctly aliases both unscoped (e.g., slate) and scoped (e.g., @deepnote/slate) package names to their local source directories in the monorepo. Paths follow the expected structure and Jest syntax is correct.

However, the configuration duplicates mappings for the same packages. If this is meant to be temporary during the migration, add a comment noting that unscoped imports should be phased out and the corresponding mappings removed once the migration is complete.

// Temporary dual mappings for migration from unscoped to @deepnote/* scoped packages.
// Once all imports are updated to use @deepnote/* names, remove the unscoped mappings below.
moduleNameMapper: {
  // TODO: Remove unscoped mappings post-migration
  '^slate$': '<rootDir>/packages/slate/src',
  '^slate-history$': '<rootDir>/packages/slate-history/src',
  '^slate-hyperscript$': '<rootDir>/packages/slate-hyperscript/src',
  '^slate-react$': '<rootDir>/packages/slate-react/src',
  // Scoped mappings (canonical)
  '^@deepnote/slate$': '<rootDir>/packages/slate/src',
  '^@deepnote/slate-history$': '<rootDir>/packages/slate-history/src',
  '^@deepnote/slate-hyperscript$': '<rootDir>/packages/slate-hyperscript/src',
  '^@deepnote/slate-react$': '<rootDir>/packages/slate-react/src',
},
🤖 Prompt for AI Agents
In jest.config.js around lines 10 to 19, the moduleNameMapper contains duplicate
mappings for unscoped and @deepnote-scoped package names; add a short comment
above the mappings stating these dual mappings are temporary for migration, mark
unscoped entries as TODO to remove once all imports use @deepnote/*, and keep
the scoped mappings as canonical; ensure the comment clearly instructs future
maintainers to remove the unscoped mappings when migration is complete.

}

module.exports = config
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"scripts": {
"build": "yarn build:rollup && yarn build:next",
"build:next": "cd ./site && next build && next export",
"build:next": "cd ./site && NODE_OPTIONS=\"$NODE_OPTIONS --openssl-legacy-provider\" next build && NODE_OPTIONS=\"$NODE_OPTIONS --openssl-legacy-provider\" next export",
"build:rollup": "rollup --config ./config/rollup/rollup.config.js",
"changesetversion": "yarn changeset version && yarn install && git add .",
"clean": "rimraf './packages/*/{dist,lib,node_modules}' './site/{.next,out}'",
Expand Down Expand Up @@ -54,6 +54,10 @@
"@babel/runtime": "^7.7.4",
"@changesets/changelog-github": "^0.3.0",
"@changesets/cli": "^2.14.1",
"@deepnote/slate": "workspace:*",
"@deepnote/slate-history": "workspace:*",
"@deepnote/slate-hyperscript": "workspace:*",
"@deepnote/slate-react": "workspace:*",
"@emotion/css": "^11.7.1",
"@testing-library/cypress": "^8.0.0",
"@types/jest": "27.0.1",
Expand Down Expand Up @@ -105,10 +109,6 @@
"rollup-plugin-typescript2": "^0.27.2",
"shell-quote": "^1.7.2",
"simple-git-hooks": ">=2.0.3",
"slate": "workspace:*",
"slate-history": "workspace:*",
"slate-hyperscript": "workspace:*",
"slate-react": "workspace:*",
"source-map-loader": "^0.2.4",
"ts-jest": "^27.1.3",
"typescript": "3.9.7"
Expand Down
13 changes: 8 additions & 5 deletions packages/slate-history/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "slate-history",
"name": "@deepnote/slate-history",
"description": "An operation-based history implementation for Slate editors.",
"version": "0.66.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"repository": "git://github.com/deepnote/slate.git",
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand All @@ -18,13 +21,13 @@
},
"devDependencies": {
"@babel/runtime": "^7.7.4",
"@deepnote/slate": "workspace:*",
"@deepnote/slate-hyperscript": "workspace:*",
"lodash": "^4.17.21",
"slate": "^0.81.0",
"slate-hyperscript": "^0.77.0",
"source-map-loader": "^0.2.4"
},
"peerDependencies": {
"slate": ">=0.65.3"
"@deepnote/slate": ">=0.65.3"
},
"umdGlobals": {
"slate": "Slate"
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-history/src/history-editor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseEditor, Editor } from 'slate'
import { BaseEditor, Editor } from '@deepnote/slate'
import { History } from './history'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-history/src/history.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isPlainObject } from 'is-plain-object'
import { Operation } from 'slate'
import { Operation } from '@deepnote/slate'

/**
* `History` objects hold all of the operations that are applied to a value, so
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-history/src/with-history.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Editor, Operation, Path } from 'slate'
import { Editor, Operation, Path } from '@deepnote/slate'

import { HistoryEditor } from './history-editor'

Expand Down
2 changes: 1 addition & 1 deletion packages/slate-history/test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert'
import { fixtures } from '../../../support/fixtures'
import { createHyperscript } from 'slate-hyperscript'
import { createHyperscript } from '@deepnote/slate-hyperscript'
import { withHistory } from '..'

describe('slate-history', () => {
Expand Down
11 changes: 7 additions & 4 deletions packages/slate-hyperscript/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "slate-hyperscript",
"name": "@deepnote/slate-hyperscript",
"description": "A hyperscript helper for creating Slate documents.",
"version": "0.77.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"repository": "git://github.com/deepnote/slate.git",
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand All @@ -18,11 +21,11 @@
},
"devDependencies": {
"@babel/runtime": "^7.7.4",
"slate": "^0.81.0",
"@deepnote/slate": "workspace:*",
"source-map-loader": "^0.2.4"
},
"peerDependencies": {
"slate": ">=0.65.3"
"@deepnote/slate": ">=0.65.3"
},
"umdGlobals": {
"slate": "Slate"
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-hyperscript/src/creators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Element, Descendant, Node, Range, Text, Editor } from 'slate'
import { Element, Descendant, Node, Range, Text, Editor } from '@deepnote/slate'
import {
AnchorToken,
FocusToken,
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-hyperscript/src/hyperscript.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isPlainObject } from 'is-plain-object'
import { Element, createEditor as makeEditor } from 'slate'
import { Element, createEditor as makeEditor } from '@deepnote/slate'
import {
createAnchor,
createCursor,
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-hyperscript/src/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Node, Path, Text } from 'slate'
import { Node, Path, Text } from '@deepnote/slate'

/**
* A weak map to hold anchor tokens.
Expand Down
15 changes: 9 additions & 6 deletions packages/slate-react/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "slate-react",
"name": "@deepnote/slate-react",
"description": "Tools for building completely customizable richtext editors with React.",
"version": "0.81.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/slate.git",
"repository": "git://github.com/deepnote/slate.git",
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand All @@ -25,6 +28,8 @@
},
"devDependencies": {
"@babel/runtime": "^7.7.4",
"@deepnote/slate": "workspace:*",
"@deepnote/slate-hyperscript": "workspace:*",
"@types/jest": "^27.4.1",
"@types/jsdom": "^16.2.14",
"@types/react": "^16.9.13",
Expand All @@ -33,14 +38,12 @@
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"react-test-renderer": ">=16.8.0",
"slate": "^0.81.0",
"slate-hyperscript": "^0.77.0",
"source-map-loader": "^0.2.4"
},
"peerDependencies": {
"@deepnote/slate": ">=0.65.3",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"slate": ">=0.65.3"
"react-dom": ">=16.8.0"
},
"umdGlobals": {
"react": "React",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Editor, Element, Node, Range, Transforms, Path, Text } from 'slate'
import {
Editor,
Element,
Node,
Range,
Transforms,
Path,
Text,
} from '@deepnote/slate'
import throttle from 'lodash/throttle'
import debounce from 'lodash/debounce'
import scrollIntoView from 'scroll-into-view-if-needed'
Expand Down
Loading
Loading